//
//  SleepBeyondCell.swift
//  DaRings
//
//  Created by 尹琼 on 2022/11/4.
//

import UIKit

import MYModule
import RxSwift
import RxCocoa

class SleepBeyondCell: SleepBaseCell {
    
    
    let chartView = SleepBarRoundChartView()
    
    
    override func makeUI() {
        super.makeUI()
        
        
        bgView.addSubview(chartView)
       
        chartView.snp.makeConstraints { make in
            make.leading.trailing.equalToSuperview()
            make.top.equalToSuperview()
            make.bottom.equalToSuperview()
        }

    }
    
    override func bind(to cellType: SleepViewModel.CellType) {
        
        guard let driver = cellType.viewModel as? BehaviorRelay<SleepDataCompareType>  else { return }
        
        driver.subscribe(onNext:{ [weak self] result in
           
            self?.chartView.setType(result)
            
        }).disposed(by: rx.disposeBag)

    }

   

   

}
